﻿#include "Server.Database.MonsterInfoFormNew.h"
#include "../Server.SMain.h"
#include "../../Shared/Enums.h"
#include "../../Shared/Functions/RegexFunctions.h"
#include "../../Server/MirDatabase/MonsterInfo.h"

using namespace Server::MirDatabase;
using namespace Server::MirEnvir;

namespace Server::Database
{

    Server::MirEnvir::Envir *MonsterInfoFormNew::getEnvir() const
    {
        return SMain::getEditEnvir();
    }

    MonsterInfoFormNew::MonsterInfoFormNew()
    {
        InitializeComponent();

        InitializeItemInfoGridView();

        CreateDynamicColumns();

        PopulateTable();

        rbtnViewBasic->Checked = true;
    }

    void MonsterInfoFormNew::InitializeItemInfoGridView()
    {
//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to the C# 'typeof' operator:
        Modified->ValueType = typeof(bool);
//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to the C# 'typeof' operator:
        MonsterIndex->ValueType = typeof(int);
//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to the C# 'typeof' operator:
        MonsterName->ValueType = typeof(std::string);
//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to the C# 'typeof' operator:
        MonsterAI->ValueType = typeof(unsigned char);
//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to the C# 'typeof' operator:
        MonsterEffect->ValueType = typeof(unsigned char);
//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to the C# 'typeof' operator:
        MonsterLevel->ValueType = typeof(unsigned short);
//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to the C# 'typeof' operator:
        MonsterLight->ValueType = typeof(unsigned char);
//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to the C# 'typeof' operator:
        MonsterAttackSpeed->ValueType = typeof(unsigned short);
//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to the C# 'typeof' operator:
        MonsterMoveSpeed->ValueType = typeof(unsigned short);
//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to the C# 'typeof' operator:
        MonsterViewRange->ValueType = typeof(unsigned char);
//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to the C# 'typeof' operator:
        MonsterCoolEye->ValueType = typeof(unsigned char);
//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to the C# 'typeof' operator:
        MonsterExperience->ValueType = typeof(unsigned int);
//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to the C# 'typeof' operator:
        MonsterCanPush->ValueType = typeof(bool);
//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to the C# 'typeof' operator:
        MonsterAutoRev->ValueType = typeof(bool);
//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to the C# 'typeof' operator:
        MonsterUndead->ValueType = typeof(bool);
//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to the C# 'typeof' operator:
        MonsterCanTame->ValueType = typeof(bool);

        //Basic
//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to the C# 'typeof' operator:
        this->MonsterImage->ValueType = typeof(Monster);
        this->MonsterImage->DataSource = Enum2DataTable<Monster>(true);
        this->MonsterImage->ValueMember = "Value";
        this->MonsterImage->DisplayMember = "Display";
    }

    void MonsterInfoFormNew::CreateDynamicColumns()
    {
        for (auto stat : *StatEnums)
        {
            if (stat == Stat::Unknown)
            {
                continue;
            }

//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to 'ToString':
            auto key = stat.ToString();
            auto strKey = RegexFunctions::SeperateCamelCase(StringHelper::replace(StringHelper::replace(StringHelper::replace(key, "Rate", ""), "Multiplier", ""), "Percent", ""));

            auto sign = "";

            if (key.find("Percent") != std::string::npos)
            {
                sign = "%";
            }
            else if (key.find("Multiplier") != std::string::npos)
            {
                sign = "x";
            }

            auto col = new DataGridViewTextBoxColumn();
            col->HeaderText = StringHelper::formatSimple("{0} {1}", strKey, sign);
//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to 'ToString':
            col->Name = "Stat" + stat.ToString();
//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to the C# 'typeof' operator:
            col->ValueType = typeof(int);
//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to 'ToString':
            col->DataPropertyName = "Stat" + stat.ToString();

            monsterInfoGridView->Columns->Add(col);

//C# TO C++ CONVERTER TODO TASK: A 'delete col' statement was not added since col was passed to a method or constructor. Handle memory management manually.
        }

    }

    void MonsterInfoFormNew::PopulateTable()
    {
        Table = new DataTable("monsterInfo");

        for (DataGridViewColumn *col : *monsterInfoGridView->Columns)
        {
            Table->Columns->Add(col->DataPropertyName, col->ValueType);
        }

        for (auto item : getEnvir()->MonsterInfoList)
        {
            DataRow *row = Table->NewRow();

            row["Modified"] = false;

            row["MonsterIndex"] = item->Index;
            row["MonsterName"] = item->Name;

            row["MonsterImage"] = item->Image;
            row["MonsterAI"] = item->AI;
            row["MonsterLevel"] = item->Level;
            row["MonsterEffect"] = item->Effect;
            row["MonsterLight"] = item->Light;
            row["MonsterAttackSpeed"] = item->AttackSpeed;
            row["MonsterMoveSpeed"] = item->MoveSpeed;
            row["MonsterViewRange"] = item->ViewRange;
            row["MonsterCoolEye"] = item->CoolEye;
            row["MonsterExperience"] = item->Experience;
            row["MonsterCanPush"] = item->CanPush;
            row["MonsterCanTame"] = item->CanTame;
            row["MonsterUndead"] = item->Undead;
            row["MonsterAutoRev"] = item->AutoRev;

            for (auto stat : *StatEnums)
            {
                if (stat == Stat::Unknown)
                {
                    continue;
                }

//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to 'ToString':
                row["Stat" + stat.ToString()] = item->Stats[stat];
            }

            Table->Rows->Add(row);
        }

        monsterInfoGridView->DataSource = Table;
    }

    void MonsterInfoFormNew::UpdateFilter()
    {
        auto filterText = txtSearch->Text;

        if (filterText.empty())
        {
            (dynamic_cast<DataTable*>(monsterInfoGridView->DataSource))->DefaultView->RowFilter = "";
            return;
        }

        std::string rowFilter = StringHelper::formatSimple("[MonsterName] LIKE '%{0}%'", filterText);

        (dynamic_cast<DataTable*>(monsterInfoGridView->DataSource))->DefaultView->RowFilter = rowFilter;
    }

    void MonsterInfoFormNew::SaveForm()
    {
        auto lastIndex = getEnvir()->MonsterInfoList.Max([&] (std::any x)
        {
            return x::Index;
        });

        for (DataGridViewRow *row : *monsterInfoGridView->Rows)
        {
            if ((static_cast<std::string>(row->Cells["MonsterName"]->Value)).empty())
            {
                continue;
            }

            MonsterInfo *monster;

            if ((static_cast<std::string>(row->Cells["MonsterIndex"].FormattedValue)).empty())
            {
                MonsterInfo tempVar();
                getEnvir()->MonsterInfoList.push_back(monster = &tempVar);

                monster->Index = ++lastIndex;
            }
            else
            {
                int index = static_cast<int>(row->Cells["MonsterIndex"]->Value);

                monster = getEnvir()->MonsterInfoList.FirstOrDefault([&] (std::any x)
                {
                    return x->Index == index;
                });

                if (row->Cells["Modified"]->Value != nullptr && static_cast<bool>(row->Cells["Modified"]->Value) == false)
                {
                    continue;
                }
            }

            monster->Name = static_cast<std::string>(row->Cells["MonsterName"]->Value);
            monster->Image = static_cast<Monster>(row->Cells["MonsterImage"]->Value);
            monster->AI = static_cast<unsigned char>(row->Cells["MonsterAI"]->Value);
            monster->Level = static_cast<unsigned short>(row->Cells["MonsterLevel"]->Value);
            monster->Effect = static_cast<unsigned char>(row->Cells["MonsterEffect"]->Value);
            monster->Light = static_cast<unsigned char>(row->Cells["MonsterLight"]->Value);
            monster->AttackSpeed = static_cast<unsigned short>(row->Cells["MonsterAttackSpeed"]->Value);
            monster->MoveSpeed = static_cast<unsigned short>(row->Cells["MonsterMoveSpeed"]->Value);
            monster->ViewRange = static_cast<unsigned char>(row->Cells["MonsterViewRange"]->Value);
            monster->CoolEye = static_cast<unsigned char>(row->Cells["MonsterCoolEye"]->Value);
            monster->Experience = static_cast<unsigned int>(row->Cells["MonsterExperience"]->Value);
            monster->CanPush = static_cast<bool>(row->Cells["MonsterCanPush"]->Value);
            monster->CanTame = static_cast<bool>(row->Cells["MonsterCanTame"]->Value);
            monster->Undead = static_cast<bool>(row->Cells["MonsterUndead"]->Value);
            monster->AutoRev = static_cast<bool>(row->Cells["MonsterAutoRev"]->Value);

            monster->Stats->Clear();

            for (DataGridViewColumn *col : *monsterInfoGridView->Columns)
            {
                if (col->Name.StartsWith("Stat"))
                {
                    auto stat = col->Name.substr(4);

//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to the C# 'typeof' operator:
                    Stat enumStat = std::any_cast<Stat>(Enum::Parse(typeof(Stat), stat));

                    monster->Stats[enumStat] = static_cast<int>(row->Cells[col->Name]->Value);
                }
            }
        }
    }

    DataRow *MonsterInfoFormNew::FindRowByMonsterName(const std::string &value)
    {
        for (DataRow *row : *Table->Rows)
        {
            auto val = row["MonsterName"];

//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to 'ToString':
            if (val == nullptr ? nullptr : (((val->ToString().Equals(value)) != nullptr) ? val->ToString().Equals(value) : false))
            {
                return row;
            }
        }

        return nullptr;
    }

    void MonsterInfoFormNew::monsterInfoGridView_CellValidating(std::any sender, DataGridViewCellValidatingEventArgs *e)
    {
        auto col = monsterInfoGridView->Columns[e->ColumnIndex];

        auto cell = monsterInfoGridView->Rows[e->RowIndex].Cells[col->Name];

//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to 'ToString':
        if (cell->FormattedValue != nullptr && e->FormattedValue != nullptr && cell->FormattedValue.ToString() == e->FormattedValue.ToString())
        {
            return;
        }

        monsterInfoGridView->Rows[e->RowIndex].Cells["Modified"]->Value = true;

//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to 'ToString':
        auto val = e->FormattedValue.ToString();

        monsterInfoGridView->Rows[e->RowIndex]->ErrorText = "";

        int val1;
//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to the C# 'typeof' operator:
        if (col->ValueType == typeof(int) && int::TryParse(val, val1) && val1 < 0)
        {
            e->Cancel = true;
            monsterInfoGridView->Rows[e->RowIndex]->ErrorText = "the value must be a positive integer";
        }

//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to the C# 'typeof' operator:
        if (col->ValueType == typeof(int) && !int::TryParse(val, _))
        {
            e->Cancel = true;
            monsterInfoGridView->Rows[e->RowIndex]->ErrorText = "the value must be an integer";
        }
//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to the C# 'typeof' operator:
        else if (col->ValueType == typeof(unsigned char) && !unsigned char::TryParse(val, _))
        {
            e->Cancel = true;
            monsterInfoGridView->Rows[e->RowIndex]->ErrorText = "the value must be a byte";
        }
//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to the C# 'typeof' operator:
        else if (col->ValueType == typeof(short) && !short::TryParse(val, _))
        {
            e->Cancel = true;
            monsterInfoGridView->Rows[e->RowIndex]->ErrorText = "the value must be a short";
        }
//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to the C# 'typeof' operator:
        else if (col->ValueType == typeof(unsigned short) && !unsigned short::TryParse(val, _))
        {
            e->Cancel = true;
            monsterInfoGridView->Rows[e->RowIndex]->ErrorText = "the value must be a ushort";
        }
//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to the C# 'typeof' operator:
        else if (col->ValueType == typeof(long long) && !long long::TryParse(val, _))
        {
            e->Cancel = true;
            monsterInfoGridView->Rows[e->RowIndex]->ErrorText = "the value must be a long";
        }
    }

    void MonsterInfoFormNew::rbtnViewAll_CheckedChanged(std::any sender, EventArgs *e)
    {
        if (rbtnViewAll->Checked)
        {
            for (DataGridViewColumn *col : *monsterInfoGridView->Columns)
            {
                if (col->Name == "Modified")
                {
                    continue;
                }

                col->Visible = true;
                continue;
            }
        }
    }

    void MonsterInfoFormNew::rbtnViewBasic_CheckedChanged(std::any sender, EventArgs *e)
    {
        if (rbtnViewBasic->Checked)
        {
            for (DataGridViewColumn *col : *monsterInfoGridView->Columns)
            {
                if (col->Name == "MonsterIndex" || col->Name == "MonsterName" || col->Name == "Modified")
                {
                    continue;
                }

                if (col->Name.StartsWith("Monster"))
                {
                    col->Visible = true;
                    continue;
                }

                if (col->Name.Equals("StatHP") || col->Name.Equals("StatMinAC") || col->Name.Equals("StatMaxAC") || col->Name.Equals("StatMinMAC") || col->Name.Equals("StatMaxMAC") || col->Name.Equals("StatMinDC") || col->Name.Equals("StatMaxDC") || col->Name.Equals("StatMinMC") || col->Name.Equals("StatMaxMC") || col->Name.Equals("StatMinSC") || col->Name.Equals("StatMaxSC") || col->Name.Equals("StatAccuracy") || col->Name.Equals("StatAgility"))
                {
                    col->Visible = true;
                    continue;
                }

                col->Visible = false;
            }
        }
    }

    void MonsterInfoFormNew::txtSearch_KeyDown(std::any sender, KeyEventArgs *e)
    {
        if (e->KeyCode == Keys->Enter)
        {
            UpdateFilter();

            e->Handled = true;
            e->SuppressKeyPress = true;
        }
    }

    void MonsterInfoFormNew::btnImport_Click(std::any sender, EventArgs *e)
    {
        OpenFileDialog *ofd = new OpenFileDialog();
        ofd->Filter = "CSV (*.csv)|*.csv";

        if (ofd->ShowDialog() == System::Windows::Forms::DialogResult::OK)
        {
            auto fileName = ofd->FileName;
            bool fileError = false;

            auto rows = File::ReadAllLines(fileName);

            if (rows.size() > 1)
            {
                auto columns = StringHelper::split(rows[0], ',');

                if (columns.size() < 2)
                {
                    fileError = true;
                    MessageBox::Show("No columns to import.");
                }

                if (!fileError)
                {
                    monsterInfoGridView->EditMode = DataGridViewEditMode::EditProgrammatically;

                    int rowsEdited = 0;

                    for (int i = 1; i < rows.size(); i++)
                    {
                        auto row = rows[i];

                        auto cells = StringHelper::split(row, ',');

                        if (StringHelper::isEmptyOrWhiteSpace(cells[0]))
                        {
                            continue;
                        }

                        if (cells.size() != columns.size())
                        {
                            fileError = true;
                            MessageBox::Show(StringHelper::formatSimple("Row {0} column count does not match the headers column count.", i));
                            break;
                        }

                        auto dataRow = FindRowByMonsterName(cells[0]);

                        monsterInfoGridView->BeginEdit(true);

                        if (dataRow == nullptr)
                        {
                            dataRow = Table->NewRow();

                            Table->Rows->Add(dataRow);
                        }

                        try
                        {
                            for (int j = 0; j < columns.size(); j++)
                            {
                                auto column = columns[j];

                                if (StringHelper::isEmptyOrWhiteSpace(column))
                                {
                                    continue;
                                }

                                auto dataColumn = monsterInfoGridView->Columns[column];

                                if (dataColumn == nullptr)
                                {
                                    fileError = true;
                                    MessageBox::Show(StringHelper::formatSimple("Column {0} was not found.", column));
                                    break;
                                }

                                if (dataColumn->ValueType->IsEnum)
                                {
                                    dataRow[column] = Enum::Parse(dataColumn->ValueType, cells[j]);
                                }
                                else
                                {
                                    dataRow[column] = cells[j];
                                }
                            }
                        }
                        catch (const std::runtime_error &ex)
                        {
                            fileError = true;
                            MessageBox::Show(StringHelper::formatSimple("Error when importing item {0}. {1}", cells[0], ex.what()));
                            continue;
                        }

                        monsterInfoGridView->EndEdit();

                        rowsEdited++;

                        if (fileError)
                        {
                            break;
                        }
                    }

                    if (!fileError)
                    {
                        MessageBox::Show(StringHelper::formatSimple("{0} monsters have been imported.", rowsEdited));
                    }
                }
            }
            else
            {
                MessageBox::Show("No rows to import.");
            }
        }

        delete ofd;
    }

    void MonsterInfoFormNew::btnExport_Click(std::any sender, EventArgs *e)
    {
        if (monsterInfoGridView->Rows->Count > 0)
        {
            SaveFileDialog *sfd = new SaveFileDialog();
            sfd->Filter = "CSV (*.csv)|*.csv";
            sfd->FileName = "MonsterInfo Output.csv";
            bool fileError = false;
            if (sfd->ShowDialog() == System::Windows::Forms::DialogResult::OK)
            {
                if (FileSystem::fileExists(sfd->FileName))
                {
                    try
                    {
                        File::Delete(sfd->FileName);
                    }
                    catch (const IOException &ex)
                    {
                        fileError = true;
                        MessageBox::Show("It wasn't possible to write the data to the disk." + ex->Message);
                    }
                }
                if (!fileError)
                {
                    try
                    {
                        int columnCount = monsterInfoGridView->Columns->Count;
                        std::string columnNames = "";
                        std::vector<std::string> outputCsv(monsterInfoGridView->Rows->Count + 1);
                        for (int i = 2; i < columnCount; i++)
                        {
//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to 'ToString':
                            columnNames += monsterInfoGridView->Columns[i]->Name.ToString() + ",";
                        }
                        outputCsv[0] += columnNames;

                        for (int i = 1; (i - 1) < monsterInfoGridView->Rows->Count; i++)
                        {
                            for (int j = 2; j < columnCount; j++)
                            {
                                auto cell = monsterInfoGridView->Rows[i - 1].Cells[j];

                                auto valueType = monsterInfoGridView->Columns[j].ValueType;
                                if (valueType->IsEnum)
                                {
//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to 'ToString':
                                    outputCsv[i] += ((Enum::ToObject(valueType, (cell->Value != nullptr) ? cell->Value : 0)) == nullptr ? nullptr : ((((Enum::ToObject(valueType, (cell->Value != nullptr) ? cell->Value : 0)).ToString()) != nullptr) ? ((Enum::ToObject(valueType, (cell->Value != nullptr) ? cell->Value : 0)).ToString()) : "")) + ",";
                                }
                                else
                                {
//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to 'ToString':
                                    outputCsv[i] += (cell->Value == nullptr ? nullptr : ((cell->Value->ToString() != nullptr) ? cell->Value->ToString() : "")) + ",";
                                }
                            }
                        }

                        File::WriteAllLines(sfd->FileName, outputCsv, Encoding::UTF8);
                        MessageBox::Show("Data Exported Successfully.", "Info");
                    }
                    catch (const std::runtime_error &ex)
                    {
                        MessageBox::Show("Error :" + ex.what());
                    }
                }
            }

            delete sfd;
        }
        else
        {
            MessageBox::Show("No Monsters To Export.", "Info");
        }
    }

    void MonsterInfoFormNew::monsterInfoGridView_DefaultValuesNeeded(std::any sender, DataGridViewRowEventArgs *e)
    {
        auto row = e->Row;

        row->Cells["Modified"]->Value = static_cast<bool>(true);

        row->Cells["MonsterName"]->Value = "";
        row->Cells["MonsterImage"]->Value = static_cast<Monster>(0);
        row->Cells["MonsterAI"]->Value = static_cast<unsigned char>(0);
        row->Cells["MonsterLevel"]->Value = static_cast<unsigned short>(0);
        row->Cells["MonsterEffect"]->Value = static_cast<unsigned char>(0);
        row->Cells["MonsterLight"]->Value = static_cast<unsigned char>(0);
        row->Cells["MonsterAttackSpeed"]->Value = static_cast<unsigned short>(2500);
        row->Cells["MonsterMoveSpeed"]->Value = static_cast<unsigned short>(1800);
        row->Cells["MonsterViewRange"]->Value = static_cast<unsigned char>(7);
        row->Cells["MonsterCoolEye"]->Value = static_cast<unsigned char>(0);
        row->Cells["MonsterExperience"]->Value = static_cast<unsigned int>(0);
        row->Cells["MonsterCanPush"]->Value = static_cast<bool>(true);
        row->Cells["MonsterCanTame"]->Value = static_cast<bool>(true);
        row->Cells["MonsterUndead"]->Value = static_cast<bool>(false);
        row->Cells["MonsterAutoRev"]->Value = static_cast<bool>(true);

        for (auto stat : *StatEnums)
        {
            if (stat == Stat::Unknown)
            {
                continue;
            }

//C# TO C++ CONVERTER TODO TASK: There is no C++ equivalent to 'ToString':
            row->Cells["Stat" + stat.ToString()]->Value = 0;
        }
    }

    void MonsterInfoFormNew::monsterInfoGridView_UserDeletingRow(std::any sender, DataGridViewRowCancelEventArgs *e)
    {
        auto row = e->Row;

        if (row->Cells["MonsterIndex"]->Value != nullptr)
        {
            int index = static_cast<int>(row->Cells["MonsterIndex"]->Value);

            auto item = getEnvir()->MonsterInfoList.FirstOrDefault([&] (std::any x)
            {
                return x->Index == index;
            });

            getEnvir()->MonsterInfoList.Remove(item);
        }
    }

    void MonsterInfoFormNew::monsterInfoFormNew_FormClosed(std::any sender, FormClosedEventArgs *e)
    {
        SaveForm();
        getEnvir()->SaveDB();
    }

    void MonsterInfoFormNew::monsterInfoGridView_DataError(std::any sender, DataGridViewDataErrorEventArgs *e)
    {

    }

    void MonsterInfoFormNew::Dispose(bool disposing)
    {
        if (disposing && (components != nullptr))
        {
            components->Dispose();
        }
        System::Windows::Forms::Form::Dispose(disposing);
    }

    void MonsterInfoFormNew::InitializeComponent()
    {
        System::Windows::Forms::DataGridViewCellStyle *dataGridViewCellStyle1 = new System::Windows::Forms::DataGridViewCellStyle();
        System::Windows::Forms::DataGridViewCellStyle *dataGridViewCellStyle2 = new System::Windows::Forms::DataGridViewCellStyle();
        this->monsterInfoGridView = new System::Windows::Forms::DataGridView();
        this->panel1 = new System::Windows::Forms::Panel();
        this->panel3 = new System::Windows::Forms::Panel();
        this->btnExport = new System::Windows::Forms::Button();
        this->btnImport = new System::Windows::Forms::Button();
        this->groupView = new System::Windows::Forms::GroupBox();
        this->rbtnViewAll = new System::Windows::Forms::RadioButton();
        this->rbtnViewBasic = new System::Windows::Forms::RadioButton();
        this->lblSearch = new System::Windows::Forms::Label();
        this->txtSearch = new System::Windows::Forms::TextBox();
        this->panel2 = new System::Windows::Forms::Panel();
        this->Modified = new System::Windows::Forms::DataGridViewCheckBoxColumn();
        this->MonsterIndex = new System::Windows::Forms::DataGridViewTextBoxColumn();
        this->MonsterName = new System::Windows::Forms::DataGridViewTextBoxColumn();
        this->MonsterImage = new System::Windows::Forms::DataGridViewComboBoxColumn();
        this->MonsterAI = new System::Windows::Forms::DataGridViewTextBoxColumn();
        this->MonsterEffect = new System::Windows::Forms::DataGridViewTextBoxColumn();
        this->MonsterLevel = new System::Windows::Forms::DataGridViewTextBoxColumn();
        this->MonsterLight = new System::Windows::Forms::DataGridViewTextBoxColumn();
        this->MonsterAttackSpeed = new System::Windows::Forms::DataGridViewTextBoxColumn();
        this->MonsterMoveSpeed = new System::Windows::Forms::DataGridViewTextBoxColumn();
        this->MonsterViewRange = new System::Windows::Forms::DataGridViewTextBoxColumn();
        this->MonsterCoolEye = new System::Windows::Forms::DataGridViewTextBoxColumn();
        this->MonsterExperience = new System::Windows::Forms::DataGridViewTextBoxColumn();
        this->MonsterCanPush = new System::Windows::Forms::DataGridViewCheckBoxColumn();
        this->MonsterAutoRev = new System::Windows::Forms::DataGridViewCheckBoxColumn();
        this->MonsterUndead = new System::Windows::Forms::DataGridViewCheckBoxColumn();
        this->MonsterCanTame = new System::Windows::Forms::DataGridViewCheckBoxColumn();
        (static_cast<System::ComponentModel::ISupportInitialize*>(this->monsterInfoGridView))->BeginInit();
        this->panel1->SuspendLayout();
        this->panel3->SuspendLayout();
        this->groupView->SuspendLayout();
        this->panel2->SuspendLayout();
        this->SuspendLayout();
        // 
        // monsterInfoGridView
        // 
        dataGridViewCellStyle1->Alignment = System::Windows::Forms::DataGridViewContentAlignment::MiddleCenter;
        this->monsterInfoGridView->AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
        this->monsterInfoGridView->ColumnHeadersHeightSizeMode = System::Windows::Forms::DataGridViewColumnHeadersHeightSizeMode::AutoSize;
        this->monsterInfoGridView->Columns->AddRange(std::vector<System::Windows::Forms::DataGridViewColumn*> {this->Modified, this->MonsterIndex, this->MonsterName, this->MonsterImage, this->MonsterAI, this->MonsterEffect, this->MonsterLevel, this->MonsterLight, this->MonsterAttackSpeed, this->MonsterMoveSpeed, this->MonsterViewRange, this->MonsterCoolEye, this->MonsterExperience, this->MonsterCanPush, this->MonsterAutoRev, this->MonsterUndead, this->MonsterCanTame});
        dataGridViewCellStyle2->Alignment = System::Windows::Forms::DataGridViewContentAlignment::MiddleCenter;
        dataGridViewCellStyle2->BackColor = System::Drawing::SystemColors::Window;
        dataGridViewCellStyle2->Font = new System::Drawing::Font("Microsoft Sans Serif", 8.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, (static_cast<unsigned char>(0)));
        dataGridViewCellStyle2->ForeColor = System::Drawing::SystemColors::ControlText;
        dataGridViewCellStyle2->SelectionBackColor = System::Drawing::SystemColors::Highlight;
        dataGridViewCellStyle2->SelectionForeColor = System::Drawing::SystemColors::HighlightText;
        dataGridViewCellStyle2->WrapMode = System::Windows::Forms::DataGridViewTriState::False;
        this->monsterInfoGridView->DefaultCellStyle = dataGridViewCellStyle2;
        this->monsterInfoGridView->Dock = System::Windows::Forms::DockStyle::Fill;
        this->monsterInfoGridView->Location = new System::Drawing::Point(0, 0);
        this->monsterInfoGridView->Name = "monsterInfoGridView";
        this->monsterInfoGridView->RowTemplate.DefaultCellStyle->Alignment = System::Windows::Forms::DataGridViewContentAlignment::MiddleCenter;
        this->monsterInfoGridView->Size = new System::Drawing::Size(956, 433);
        this->monsterInfoGridView->TabIndex = 0;
        this->monsterInfoGridView->CellValidating += new System::Windows::Forms::DataGridViewCellValidatingEventHandler(this->monsterInfoGridView_CellValidating);
        this->monsterInfoGridView->DataError += new System::Windows::Forms::DataGridViewDataErrorEventHandler(this->monsterInfoGridView_DataError);
        this->monsterInfoGridView->DefaultValuesNeeded += new System::Windows::Forms::DataGridViewRowEventHandler(this->monsterInfoGridView_DefaultValuesNeeded);
        this->monsterInfoGridView->UserDeletingRow += new System::Windows::Forms::DataGridViewRowCancelEventHandler(this->monsterInfoGridView_UserDeletingRow);
        // 
        // panel1
        // 
        this->panel1->Controls->Add(this->panel3);
        this->panel1->Dock = System::Windows::Forms::DockStyle::Top;
        this->panel1->Location = new System::Drawing::Point(0, 0);
        this->panel1->Name = "panel1";
        this->panel1->Size = new System::Drawing::Size(956, 47);
        this->panel1->TabIndex = 1;
        // 
        // panel3
        // 
        this->panel3->Controls->Add(this->btnExport);
        this->panel3->Controls->Add(this->btnImport);
        this->panel3->Controls->Add(this->groupView);
        this->panel3->Controls->Add(this->lblSearch);
        this->panel3->Controls->Add(this->txtSearch);
        this->panel3->Dock = System::Windows::Forms::DockStyle::Fill;
        this->panel3->Location = new System::Drawing::Point(0, 0);
        this->panel3->Name = "panel3";
        this->panel3->Size = new System::Drawing::Size(956, 47);
        this->panel3->TabIndex = 5;
        // 
        // btnExport
        // 
        this->btnExport->Location = new System::Drawing::Point(693, 22);
        this->btnExport->Name = "btnExport";
        this->btnExport->Size = new System::Drawing::Size(75, 23);
        this->btnExport->TabIndex = 6;
        this->btnExport->Text = "Export";
        this->btnExport->UseVisualStyleBackColor = true;
        this->btnExport->Click += new System::EventHandler(this->btnExport_Click);
        // 
        // btnImport
        // 
        this->btnImport->Location = new System::Drawing::Point(611, 22);
        this->btnImport->Name = "btnImport";
        this->btnImport->Size = new System::Drawing::Size(75, 23);
        this->btnImport->TabIndex = 5;
        this->btnImport->Text = "Import";
        this->btnImport->UseVisualStyleBackColor = true;
        this->btnImport->Click += new System::EventHandler(this->btnImport_Click);
        // 
        // groupView
        // 
        this->groupView->Controls->Add(this->rbtnViewAll);
        this->groupView->Controls->Add(this->rbtnViewBasic);
        this->groupView->Enabled = false;
        this->groupView->Location = new System::Drawing::Point(3, 3);
        this->groupView->Name = "groupView";
        this->groupView->Size = new System::Drawing::Size(134, 42);
        this->groupView->TabIndex = 4;
        this->groupView->TabStop = false;
        this->groupView->Text = "View Mode";
        // 
        // rbtnViewAll
        // 
        this->rbtnViewAll->AutoSize = true;
        this->rbtnViewAll->Checked = true;
        this->rbtnViewAll->Location = new System::Drawing::Point(27, 19);
        this->rbtnViewAll->Name = "rbtnViewAll";
        this->rbtnViewAll->Size = new System::Drawing::Size(36, 17);
        this->rbtnViewAll->TabIndex = 0;
        this->rbtnViewAll->TabStop = true;
        this->rbtnViewAll->Text = "All";
        this->rbtnViewAll->UseVisualStyleBackColor = true;
        this->rbtnViewAll->CheckedChanged += new System::EventHandler(this->rbtnViewAll_CheckedChanged);
        // 
        // rbtnViewBasic
        // 
        this->rbtnViewBasic->AutoSize = true;
        this->rbtnViewBasic->Location = new System::Drawing::Point(69, 19);
        this->rbtnViewBasic->Name = "rbtnViewBasic";
        this->rbtnViewBasic->Size = new System::Drawing::Size(51, 17);
        this->rbtnViewBasic->TabIndex = 1;
        this->rbtnViewBasic->Text = "Basic";
        this->rbtnViewBasic->UseVisualStyleBackColor = true;
        this->rbtnViewBasic->CheckedChanged += new System::EventHandler(this->rbtnViewBasic_CheckedChanged);
        // 
        // lblSearch
        // 
        this->lblSearch->AutoSize = true;
        this->lblSearch->Location = new System::Drawing::Point(461, 9);
        this->lblSearch->Name = "lblSearch";
        this->lblSearch->Size = new System::Drawing::Size(44, 13);
        this->lblSearch->TabIndex = 1;
        this->lblSearch->Text = "Search:";
        // 
        // txtSearch
        // 
        this->txtSearch->Location = new System::Drawing::Point(464, 25);
        this->txtSearch->Name = "txtSearch";
        this->txtSearch->Size = new System::Drawing::Size(141, 20);
        this->txtSearch->TabIndex = 0;
        this->txtSearch->KeyDown += new System::Windows::Forms::KeyEventHandler(this->txtSearch_KeyDown);
        // 
        // panel2
        // 
        this->panel2->Controls->Add(this->monsterInfoGridView);
        this->panel2->Dock = System::Windows::Forms::DockStyle::Fill;
        this->panel2->Location = new System::Drawing::Point(0, 47);
        this->panel2->Name = "panel2";
        this->panel2->Size = new System::Drawing::Size(956, 433);
        this->panel2->TabIndex = 2;
        // 
        // Modified
        // 
        this->Modified->AutoSizeMode = System::Windows::Forms::DataGridViewAutoSizeColumnMode::ColumnHeader;
        this->Modified->DataPropertyName = "Modified";
        this->Modified->Frozen = true;
        this->Modified->HeaderText = "Modified";
        this->Modified->Name = "Modified";
        this->Modified->ReadOnly = true;
        this->Modified->Width = 53;
        // 
        // MonsterIndex
        // 
        this->MonsterIndex->AutoSizeMode = System::Windows::Forms::DataGridViewAutoSizeColumnMode::AllCells;
        this->MonsterIndex->DataPropertyName = "MonsterIndex";
        this->MonsterIndex->Frozen = true;
        this->MonsterIndex->HeaderText = "Index";
        this->MonsterIndex->Name = "MonsterIndex";
        this->MonsterIndex->ReadOnly = true;
        this->MonsterIndex->Width = 58;
        // 
        // MonsterName
        // 
        this->MonsterName->AutoSizeMode = System::Windows::Forms::DataGridViewAutoSizeColumnMode::DisplayedCells;
        this->MonsterName->DataPropertyName = "MonsterName";
        this->MonsterName->Frozen = true;
        this->MonsterName->HeaderText = "Name";
        this->MonsterName->Name = "MonsterName";
        this->MonsterName->Width = 60;
        // 
        // MonsterImage
        // 
        this->MonsterImage->DataPropertyName = "MonsterImage";
        this->MonsterImage->HeaderText = "Image";
        this->MonsterImage->Name = "MonsterImage";
        this->MonsterImage->SortMode = System::Windows::Forms::DataGridViewColumnSortMode::Automatic;
        // 
        // MonsterAI
        // 
        this->MonsterAI->DataPropertyName = "MonsterAI";
        this->MonsterAI->HeaderText = "AI";
        this->MonsterAI->Name = "MonsterAI";
        // 
        // MonsterEffect
        // 
        this->MonsterEffect->DataPropertyName = "MonsterEffect";
        this->MonsterEffect->HeaderText = "Effect";
        this->MonsterEffect->Name = "MonsterEffect";
        // 
        // MonsterLevel
        // 
        this->MonsterLevel->DataPropertyName = "MonsterLevel";
        this->MonsterLevel->HeaderText = "Level";
        this->MonsterLevel->Name = "MonsterLevel";
        // 
        // MonsterLight
        // 
        this->MonsterLight->DataPropertyName = "MonsterLight";
        this->MonsterLight->HeaderText = "Light";
        this->MonsterLight->Name = "MonsterLight";
        // 
        // MonsterAttackSpeed
        // 
        this->MonsterAttackSpeed->DataPropertyName = "MonsterAttackSpeed";
        this->MonsterAttackSpeed->HeaderText = "Attack Speed";
        this->MonsterAttackSpeed->Name = "MonsterAttackSpeed";
        // 
        // MonsterMoveSpeed
        // 
        this->MonsterMoveSpeed->DataPropertyName = "MonsterMoveSpeed";
        this->MonsterMoveSpeed->HeaderText = "Move Speed";
        this->MonsterMoveSpeed->Name = "MonsterMoveSpeed";
        // 
        // MonsterViewRange
        // 
        this->MonsterViewRange->DataPropertyName = "MonsterViewRange";
        this->MonsterViewRange->HeaderText = "View Range";
        this->MonsterViewRange->Name = "MonsterViewRange";
        // 
        // MonsterCoolEye
        // 
        this->MonsterCoolEye->DataPropertyName = "MonsterCoolEye";
        this->MonsterCoolEye->HeaderText = "Cool Eye";
        this->MonsterCoolEye->Name = "MonsterCoolEye";
        // 
        // MonsterExperience
        // 
        this->MonsterExperience->DataPropertyName = "MonsterExperience";
        this->MonsterExperience->HeaderText = "Experience";
        this->MonsterExperience->Name = "MonsterExperience";
        // 
        // MonsterCanPush
        // 
        this->MonsterCanPush->DataPropertyName = "MonsterCanPush";
        this->MonsterCanPush->HeaderText = "Can Push";
        this->MonsterCanPush->Name = "MonsterCanPush";
        this->MonsterCanPush->Resizable = System::Windows::Forms::DataGridViewTriState::True;
        this->MonsterCanPush->SortMode = System::Windows::Forms::DataGridViewColumnSortMode::Automatic;
        // 
        // MonsterAutoRev
        // 
        this->MonsterAutoRev->DataPropertyName = "MonsterAutoRev";
        this->MonsterAutoRev->HeaderText = "Auto Rev";
        this->MonsterAutoRev->Name = "MonsterAutoRev";
        this->MonsterAutoRev->Resizable = System::Windows::Forms::DataGridViewTriState::True;
        this->MonsterAutoRev->SortMode = System::Windows::Forms::DataGridViewColumnSortMode::Automatic;
        // 
        // MonsterUndead
        // 
        this->MonsterUndead->DataPropertyName = "MonsterUndead";
        this->MonsterUndead->HeaderText = "Undead";
        this->MonsterUndead->Name = "MonsterUndead";
        this->MonsterUndead->Resizable = System::Windows::Forms::DataGridViewTriState::True;
        this->MonsterUndead->SortMode = System::Windows::Forms::DataGridViewColumnSortMode::Automatic;
        // 
        // MonsterCanTame
        // 
        this->MonsterCanTame->DataPropertyName = "MonsterCanTame";
        this->MonsterCanTame->HeaderText = "Can Tame";
        this->MonsterCanTame->Name = "MonsterCanTame";
        this->MonsterCanTame->Resizable = System::Windows::Forms::DataGridViewTriState::True;
        this->MonsterCanTame->SortMode = System::Windows::Forms::DataGridViewColumnSortMode::Automatic;
        // 
        // MonsterInfoFormNew
        // 
        this->AutoScaleDimensions = new System::Drawing::SizeF(6.0F, 13.0F);
        this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
        this->ClientSize = new System::Drawing::Size(956, 480);
        this->Controls->Add(this->panel2);
        this->Controls->Add(this->panel1);
        this->Name = "MonsterInfoFormNew";
        this->Text = "MonsterInfoFormNew";
        this->FormClosed += new System::Windows::Forms::FormClosedEventHandler(this->monsterInfoFormNew_FormClosed);
        (static_cast<System::ComponentModel::ISupportInitialize*>(this->monsterInfoGridView))->EndInit();
        this->panel1->ResumeLayout(false);
        this->panel3->ResumeLayout(false);
        this->panel3->PerformLayout();
        this->groupView->ResumeLayout(false);
        this->groupView->PerformLayout();
        this->panel2->ResumeLayout(false);
        this->ResumeLayout(false);

//C# TO C++ CONVERTER TODO TASK: A 'delete dataGridViewCellStyle2' statement was not added since dataGridViewCellStyle2 was assigned to another object. Handle memory management manually.
//C# TO C++ CONVERTER TODO TASK: A 'delete dataGridViewCellStyle1' statement was not added since dataGridViewCellStyle1 was assigned to another object. Handle memory management manually.
    }
}
